package org.bot.plugin.web.event;

import org.bot.api.event.DataStorage;
import org.bot.api.event.EventName;
import org.bot.api.event.Events;
import org.bot.api.flow.FlowNode;
import org.bot.api.source.SourceManage;
import org.bot.plugin.web.source.SourceManageImpl;
import org.bot.plugin.web.util.WebApi;
import org.openqa.selenium.WebDriver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@EventName("关闭浏览器")
public class WebQuit implements Events {

    @Autowired
    WebApi webApi;

    @Autowired
    SourceManage sourceManage;

    @Override
    public Object exec(FlowNode note, DataStorage data) {
        sourceManage.releaseSource(webApi.getWebDriver(note));
        return null;
    }
}
